package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchSiteComprehensiveWaterQualityQualifiedRateStats;
import com.ruoyi.system.service.IDispatchSiteComprehensiveWaterQualityQualifiedRateStatsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 站点综合水质合格率统计Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchSiteComprehensiveWaterQualityQualifiedRateStats")
public class DispatchSiteComprehensiveWaterQualityQualifiedRateStatsController extends BaseController
{
    @Autowired
    private IDispatchSiteComprehensiveWaterQualityQualifiedRateStatsService dispatchSiteComprehensiveWaterQualityQualifiedRateStatsService;

    /**
     * 查询站点综合水质合格率统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteComprehensiveWaterQualityQualifiedRateStats:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchSiteComprehensiveWaterQualityQualifiedRateStats dispatchSiteComprehensiveWaterQualityQualifiedRateStats)
    {
        startPage();
        List<DispatchSiteComprehensiveWaterQualityQualifiedRateStats> list = dispatchSiteComprehensiveWaterQualityQualifiedRateStatsService.selectDispatchSiteComprehensiveWaterQualityQualifiedRateStatsList(dispatchSiteComprehensiveWaterQualityQualifiedRateStats);
        return getDataTable(list);
    }

    /**
     * 导出站点综合水质合格率统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteComprehensiveWaterQualityQualifiedRateStats:export')")
    @Log(title = "站点综合水质合格率统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchSiteComprehensiveWaterQualityQualifiedRateStats dispatchSiteComprehensiveWaterQualityQualifiedRateStats)
    {
        List<DispatchSiteComprehensiveWaterQualityQualifiedRateStats> list = dispatchSiteComprehensiveWaterQualityQualifiedRateStatsService.selectDispatchSiteComprehensiveWaterQualityQualifiedRateStatsList(dispatchSiteComprehensiveWaterQualityQualifiedRateStats);
        ExcelUtil<DispatchSiteComprehensiveWaterQualityQualifiedRateStats> util = new ExcelUtil<DispatchSiteComprehensiveWaterQualityQualifiedRateStats>(DispatchSiteComprehensiveWaterQualityQualifiedRateStats.class);
        util.exportExcel(response, list, "站点综合水质合格率统计数据");
    }

    /**
     * 获取站点综合水质合格率统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteComprehensiveWaterQualityQualifiedRateStats:query')")
    @GetMapping(value = "/{siteComprehensiveWaterQualityQualifiedRateStatsId}")
    public AjaxResult getInfo(@PathVariable("siteComprehensiveWaterQualityQualifiedRateStatsId") Long siteComprehensiveWaterQualityQualifiedRateStatsId)
    {
        return success(dispatchSiteComprehensiveWaterQualityQualifiedRateStatsService.selectDispatchSiteComprehensiveWaterQualityQualifiedRateStatsBySiteComprehensiveWaterQualityQualifiedRateStatsId(siteComprehensiveWaterQualityQualifiedRateStatsId));
    }

    /**
     * 新增站点综合水质合格率统计
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteComprehensiveWaterQualityQualifiedRateStats:add')")
    @Log(title = "站点综合水质合格率统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchSiteComprehensiveWaterQualityQualifiedRateStats dispatchSiteComprehensiveWaterQualityQualifiedRateStats)
    {
        return toAjax(dispatchSiteComprehensiveWaterQualityQualifiedRateStatsService.insertDispatchSiteComprehensiveWaterQualityQualifiedRateStats(dispatchSiteComprehensiveWaterQualityQualifiedRateStats));
    }

    /**
     * 修改站点综合水质合格率统计
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteComprehensiveWaterQualityQualifiedRateStats:edit')")
    @Log(title = "站点综合水质合格率统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchSiteComprehensiveWaterQualityQualifiedRateStats dispatchSiteComprehensiveWaterQualityQualifiedRateStats)
    {
        return toAjax(dispatchSiteComprehensiveWaterQualityQualifiedRateStatsService.updateDispatchSiteComprehensiveWaterQualityQualifiedRateStats(dispatchSiteComprehensiveWaterQualityQualifiedRateStats));
    }

    /**
     * 删除站点综合水质合格率统计
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteComprehensiveWaterQualityQualifiedRateStats:remove')")
    @Log(title = "站点综合水质合格率统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{siteComprehensiveWaterQualityQualifiedRateStatsIds}")
    public AjaxResult remove(@PathVariable Long[] siteComprehensiveWaterQualityQualifiedRateStatsIds)
    {
        return toAjax(dispatchSiteComprehensiveWaterQualityQualifiedRateStatsService.deleteDispatchSiteComprehensiveWaterQualityQualifiedRateStatsBySiteComprehensiveWaterQualityQualifiedRateStatsIds(siteComprehensiveWaterQualityQualifiedRateStatsIds));
    }
}
